﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class bullet2 : MonoBehaviour
{

    public float speed;


    void Update()
    {
        transform.Translate(Vector3.up * speed * Time.deltaTime);
    }


    private void OnTriggerEnter2D(Collider2D collision)
    {
        switch (collision.gameObject.tag)
        {
            case "player":
                collision.gameObject.GetComponent<playermanager>().damaged();
                Destroy(gameObject);
                break;
            case "wall":
                Destroy(collision.gameObject);
                Destroy(gameObject);
                break;
            case "barrier":
                Destroy(gameObject);
                break;
            case "heart":
                collision.gameObject.GetComponent<heartmanager>().damaged();
                Destroy(gameObject);
                break;
            //case "enemy":
            //    Destroy(gameObject);
            //    break;
        }
    }
}
